<?php
error_reporting(0);
$isadmin=1;    
include '../../comm/config.php';
include '../check.php';
include('../../comm/class_db.php');
$link = mysql_connect($dbserver, $dbuser, $dbpass);
mysql_query("set names utf8");	
mysql_select_db($dbname);
$id=$_GET['id'];
$mall = sql_sel("mall", "*", "id", $id);
$mall['catid']?$mall['catid']:1000;
$sql="select * from ".$BIAOTOU."malltype  order by sort asc";
$malltype = mysql_query($sql);
mysql_close($link);
$mall['lm']=$mall['lm']?$mall['lm']:'yiqifa';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<style> 
.disable{border:#999 1px solid; background:#CCC;}
</style>
<script language="javascript" type="text/javascript" src="../../js/jquery.js"></script>
<script charset="utf-8" src="../../kindeditor/kindeditor.js"></script>
<script>
			KE.show({
				id : 'content',
				cssPath : './index.css',
				afterCreate : function(id) {
					KE.event.ctrl(document, 13, function() {
						KE.util.setData(id);
						document.forms['example'].submit();
					});
					KE.event.ctrl(KE.g[id].iframeDoc, 13, function() {
						KE.util.setData(id);
						document.forms['example'].submit();
					});
				}
			});
</script>
<script language="javascript" type="text/javascript">	
$(function(){
    $('#lm').change(function(){
	    var lm = $(this).val();
	    if(lm=='yiqifa'){
			$('#yilink').attr('readonly','').removeClass('disable');
			$('#merchant').attr('readonly','readonly').addClass('disable');
			//$('#chalink').attr('readonly','readonly').addClass('disable');
	    }
/*		if(lm=='chanet'){
			$('#chalink').attr('readonly','').removeClass('disable');
			$('#merchant').attr('readonly','readonly').addClass('disable');
			$('#yilink').attr('readonly','readonly').addClass('disable');
	    }*/
		if(lm=='linktech'){
			$('#merchant').attr('readonly','').removeClass('disable');
			$('#yilink').attr('readonly','readonly').addClass('disable');
			//$('#chanet').attr('readonly','readonly').addClass('disable');
	    }
	});
});

function tSubmit(form){
	if(form.name.value==''){
		alert('请填写商城名！');
		form.name.focus();
		return false;
	}
	if(form.fan.value==''){
		alert('请填写最高返现额度！');
		form.fan.focus();
		return false;
	}
	if(form.picname.value==''){
		alert('请上传商城logo！');
		return false;
	}
	if(form.url.value==''){
		alert('请填写商城官网！');
		form.url.focus();
		return false;
	}
	if(lm=='linktech'){
	    if(form.merchant.value==''){
		    alert('请填写广告主账号！');
		    form.merchant.focus();
		    return false;
	    }
	}
	else if(lm=='yiqifa'){
	    if(form.yilink.value==''){
		    alert('请填写推广链接！');
		    form.yilink.focus();
		    return false;
	    }
	}
	/*else if(lm=='chanet'){
	    if(form.chalink.value==''){
		    alert('请填写推广链接！');
		    form.chalink.focus();
		    return false;
	    }
	}*/
	return true;
}
</script>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 添加新的商城</strong></td>
            </tr>
            <tr>
              <td width="100%" colspan="2" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><form id="form1" name="form1" method="post" action="mallsave.php" onsubmit="return tSubmit(this);">
<br />
<table width="751"  align="center" border=1 cellpadding=0 cellspacing=0
style="border-collapse: collapse" bordercolor="#dddddd">
                      <tr>
                        <td width="96" height="30" align="right" class="bigtext">商城类别：</td>
                        <td width="281" height="30" class="bigtext">&nbsp;<select name="cat">
                         <?php
						 while ($row = mysql_fetch_array($malltype))
						 {
						 	if($mall['catid']==$row['typecode']){
								$isselected=" selected";
							}else{
								$isselected="";
							}
						 	echo "<option value=".$row['typecode']."".$isselected.">".$row['typename']."</option>";
						 }
						 ?>
                        </select>
                        &nbsp;&nbsp;&nbsp;&nbsp;所属联盟：<select name="lm" id="lm"><option <?php if($mall['lm']=='yiqifa'){?> selected="selected" <?php }?> value="yiqifa">亿起发</option><option <?php if($mall['lm']=='linktech'){?> selected="selected" <?php }?> value="linktech">领客特</option></select></td>
                        <td width="72" align="right" class="bigtext">最高返：                          </td>
                        <td width="292" class="bigtext">&nbsp;<input name="fan" type="text" style="width:113px"  id="fan" value="<?=$mall['fan']?>"/></td>
                      </tr>
                      <tr>
                        <td width="96" height="30" align="right" class="bigtext">广告账号：</td>
                        <td height="30" class="bigtext">&nbsp;<input name="merchant" type="text" value="<?=$mall['merchant']?>" style="width:150px" id="merchant" <?php if($mall['lm']!='linktech'){?>readonly="readonly" class="disable" <?php }?> /> (领客特专用)  </td>
                        <td height="30" align="right" class="bigtext">商城名：</td>
                        <td height="30" class="bigtext">&nbsp;<input name="name" type="text" value="<?=$mall['name']?>"  style="width:150px" id="name" /></td>
                      </tr>
					   <tr>
                        <td width="96" height="30" align="right" class="bigtext">商城地址：</td>
                        <td height="30">&nbsp;<input name="url" type="text" size="60" id="url" value="<?=$mall['url']?>" style="width:150px"/></td>
                        <td height="30" align="right">&nbsp;排序：</td>
					    <td height="30">&nbsp;<input name="sort" type="text"  style="width:83px"  id="sort" value="<?=$mall['sort']?>"/>
                          <span style="color:#999; font-size:12px">数字越大越靠前</span></td>
					   </tr>
                       <tr>
                        <td width="96" height="30" align="right" class="bigtext">亿起发推广网址：</td>
                        <td height="30" colspan="3" class="bigtext">&nbsp;<input  name="yilink" type="text" size="60" id="yilink" value="<?=$mall['yilink']?>" <?php if($mall['lm']!='yiqifa'){?>readonly="readonly" class="disable" <?php }?>/></td>
                      </tr>
                      <tr>
                        <td width="96" height="30" align="right" class="bigtext">商城logo：</td>
                        <td height="30" class="bigtext">&nbsp;<IFRAME frameBorder=0 
                        height=25 name=ad scrolling=no 
                        src="../uppic.php?pic=<?php echo $mall['logo'];?>" 
                        width="98%"></IFRAME>                         </td>
                        <td height="30" colspan="2" class="bigtext">(如果修改请保持空白，像素140*100)</td>
                        </tr>
                      <tr>
                        <td width="96" height="30" align="right" class="bigtext">简介：</td>
                        <td height="30" colspan="3" class="bigtext">&nbsp;<input name="des" type="text" size="60" id="des" value="<?=$mall['des']?>"/>                         </td>
                      </tr>
                      <tr>
                        <td width="96" height="30" align="right" class="bigtext">服务：</td>
                        <td height="30" colspan="3" class="bigtext">
                        &nbsp;货到付款：
                        <input type="text" style="width:50px" name="hdfk" id="hdfk"  value="<?php if($mall['hdfk']==''){echo "是";}else{echo $mall['hdfk'];}?>" />
                        &nbsp;正规发票：<input type="text" style="width:50px" name="zgfp" id="zgfp"  value="<?php if($mall['zgfp']==''){echo "是";}else{echo $mall['zgfp'];}?>" />
                        &nbsp;运费政策：<input type="text" style="width:50px" name="yfzc" id="yfzc"  value="<?php if($mall['yfzc']==''){echo "是";}else{echo $mall['yfzc'];}?>"/><input name="picname" id="picname" type="hidden" style="width:253px" maxlength="255" value="<?=$mall['logo']?>" />                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">介绍：</td>
                        <td height="30" colspan="3"><textarea id="content" name="content" style="width:600px;height:200px;visibility:hidden;">
    <?=htmlspecialchars($mall ['js'])?>
    </textarea></td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">提交：</td>
                        <td height="30" colspan="3"><table width="455" height="30" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="190">&nbsp;<input type="submit" value="提交" /></td>
    <td width="265"><a href="http://bbs.duoduo123.com/read-htm-tid-7522.html" target="_blank">亿起发教程</a> <a href="http://soft.duoduo123.com/help/V70/2011/0221/145.html" target="_blank">&nbsp;领客特教程</a></td>
  </tr>
</table></td>
                      </tr>
                    </table>
                    <input type="hidden" name="id" value="<?=$id?>"  />
                  </form>
                  </td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>
